import { ready } from '@/lib/utils';
import { setupPage } from './lib';

import { tf } from '@/components/table/lib';


(function () {
    ready(() => {
        setupPage({
            getDataApiUrl: `/api/audit/file`,
            submitChangedDataApiUrl: '/api/audit/audit',
            columnDefs: [
                {
                    field: "filename",
                    headerName: gettext("文件"),
                    type: 'file_name',
                    cellRendererParams: (params: any) => {
                        return {
                            contentType: params.data.content_type,
                            iconClass: 'tw:size-4'
                        }
                    },
                    minWidth: 200,
                    flex: 1
                },
                {
                    field: "file_size",
                    headerName: gettext("文件大小"),
                    type: 'file_size'
                },
                {
                    ...tf("uploaded_at", "上传时间"),
                    type: 'date'
                },
                {
                    field: 'owner',
                    headerName: gettext("文件上传者"),
                    width: 120,
                },
                {
                    field: 'requester',
                    headerName: gettext("请求访问者"),
                    width: 120,
                }

            ]
        })
    });
})();
